﻿
function GetURL(_0xc198x16) {
    var _0xc198xb = window['location']['href'];
    if (_0xc198xb['indexOf']('?') > -1) {
        _0xc198xb = _0xc198xb['substr'](0, _0xc198xb['indexOf']('?'));
    };
    _0xc198xb = _0xc198xb['replace']('http://', '')['replace'](window['location']['host'] + '/', '');
    urlp = _0xc198xb['split']('/');
    if (_0xc198x16 == 'parent') {
        return urlp[0]['replace']('.aspx', '');
    };
    if (typeof urlp[1] !== 'undefined') {
        if (_0xc198x16 == 'child') {
            return urlp[1]['replace']('.aspx', '');
        };
    };
};

function UIBlock(_0xc198x2e) {
    $['blockUI']({
        fadeIn: 1000,
        timeout: 3000,
        message: '<p>' + _0xc198x2e + '</p>'
    });
};

function UIBlock_nonTimeout(message) {
    
    $['blockUI']({
        fadeIn: 1000,
        message: '<p>' + message + '</p>'
    });
};


var a = $(".required");
a["each"](function () {
    var a = $(this)["attr"]("name");
    $('[for="' + a + '"]')['append']('<span style="color: red">*</span>');
});


function CallAjax(urlx, parameter) {
    $.ajax({
        type: 'GET',
        url: urlx + parameter,
        contentType: 'application/json',
        dataType: 'json',
        data: '{}',
        success: function (data) {
            if (data.IsSuccess) {
                 alert(data.Message);
                //UIBlock_nonTimeout(data.Message);
            }
            else {
                alert(data.Message);
                //UIBlock_nonTimeout(data.Message);
            }
        },
        error: function (response) {
            var r = JSON.parse(response.responseText);
            alert("Error Message: " + r.Message);
        }
    });
}

function CallAjax(urlx, parameter, jsondata) {
    $.ajax({
        type: 'POST',
        url: urlx + parameter,
        contentType: 'application/json',
        dataType: 'json',
        data: jsondata,
        success: function (data) {
            if (data.IsSuccess) {
                alert(data.Message);
                //UIBlock_nonTimeout(data.Message);
                //$.msgBox(data.Message, null, { title: "Pesan" });
                //$['unblockUI']();
            }
            else {
                alert(data.Message);
                //UIBlock_nonTimeout(data.Message);
                //$.msgBox(data.Message, null, { title: "Pesan" });
            }
        },
        error: function (response) {
            var r = JSON.parse(response.responseText);
            alert("Error Message: " + r.Message);
        }
    });
}